//
//  YPVideoPickerViewController.m
//  test
//
//  Created by 谭亚明 on 2020/3/20.
//  Copyright © 2020 test. All rights reserved.
//

#import "YPVideoPickerViewController.h"
#import "UIimage+Extends.h"
@interface YPVideoPickerViewController ()
@property (nonatomic, strong) TYMButton *btnDone;
@property(nonatomic,strong) TYMButton *backBtn;
@end

@implementation YPVideoPickerViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.bottomView.hidden = YES;
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:rgba(19, 19, 19)] forBarMetrics:UIBarMetricsDefault];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.btnDone];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_home14"] style:UIBarButtonItemStylePlain target:self action:@selector(jumpBack)];
    @weakify(self)
    self.selectfunc = ^(NSInteger count) {
        @strongify(self)
        if (count == 0) {
            self.btnDone.selected = NO;
            [self.btnDone setBackgroundColor:hexColor(0x0C353D)];
            self.btnDone.userInteractionEnabled = NO;
        }else{
            self.btnDone.selected = count >0;
            [self.btnDone setBackgroundColor:rgba(76, 132, 255)];
            self.btnDone.userInteractionEnabled = YES;
        }
    };
    [self.btnDone addTarget:self action:@selector(doneClick) forControlEvents:UIControlEventTouchUpInside];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    if(self.navigationController.navigationBarHidden){
           [self.navigationController setNavigationBarHidden:NO animated:YES];
    }
}

- (void)jumpBack{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)doneClick{
    [self doneFinishPicker];
}

- (TYMButton *)btnDone{
    if (_btnDone == nil) {
        _btnDone = [TYMButton btn_nText:@"确定0/1" sText:@"确定1/1" nColor:hexColor(0x999999) sColor:hexColor(0xFFFFFF) font:Font_Regular(14)];
        [_btnDone setBackgroundColor:rgba(76, 132, 255)];
        [_btnDone mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(72);
            make.height.mas_equalTo(24);
        }];
        _btnDone.layer.cornerRadius = 12;
        _btnDone.userInteractionEnabled = NO;
        
    }
    return _btnDone;;
}

-(void)dealloc{
    NSLog(@"++++++++++++++++++++++++++++++++ 照片选中器释放++++++++++++++++++++++");
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
